namespace EFS.Common.Generators
{
	public class UId
	{
		/// Builder 
		System.Text.StringBuilder sb = new System.Text.StringBuilder();

		/// Separation char
		System.Char separatorChar = '-';

		/// Separation char
		System.String separatorString = "";

		/// Coinstructor
		public UId()
		{
		}

		/// Coinstructor
		public UId(System.Char separator)
		{
			this.separatorChar = separator;
		}

		/// Coinstructor
		public UId(System.String separator)
		{
			this.separatorString = separator;
		}

		/// Property Separator: Get
		public System.String Separator
		{
			get
			{
				System.String separator = new System.String(separatorChar, 1);
				if (EFS.Common.Verify.String(separatorString))
				{
					separator = separatorString;
				}

				// ok
				return separator;
			}
		}

		/// Append element to UId
		public void Append(EFS.Common.Generators.Abstract.Interfaces.IElement element, System.Int32 length)
		{
			if (0 < sb.Length)
			{
				sb.Append(Separator);
			}
			sb.Append(element.New(length));
		}

		/// To string 
		public override System.String ToString()
		{
			return sb.ToString();
		}
	}
}
